$(function() {
    $(".btn-primary").click(function() {
        var _writeOffTime_start = $("#ordersearch-writeofftime_start").val();
        var _writeOffTime_end = $("#ordersearch-writeofftime_end").val();
        if (_writeOffTime_start == '' && _writeOffTime_end == '') {
            alert("亲, 请选择日期的组合");
            return false;
        }
        if (_writeOffTime_start != '' && _writeOffTime_end == '') {
            alert("亲, 请选择交易结束日期");
            return false;
        }
        if (_writeOffTime_end != '' && _writeOffTime_start == '') {
            alert("亲, 请选择交易开始日期");
            return false;
        }
        var day1 = new Date(_writeOffTime_start.replace(/\-/g, "\/"));
        var day2 = new Date(_writeOffTime_end.replace(/\-/g, "\/"));

        if (day1 > day2)
        {
            alert("开始时间不能大于结束时间！");
            return false;
        }
    });
});
